package com.google.appengine.api.memcache;

import lombok.Data;

/**
 *
 * @author Secondary User
 */
@Data
public class Expiration
{

	private final long expiryTime;
	private final static long DEFAULT_EXPIRY_MILLISECONDS = 3600000; //1 hour

	public static Expiration byDeltaSeconds(Integer expirySeconds)
	{
		if (expirySeconds == null)
		{
			return new Expiration(System.currentTimeMillis() + DEFAULT_EXPIRY_MILLISECONDS);
		}
		else
		{
			return new Expiration(System.currentTimeMillis() + expirySeconds + 1000);
		}
	}
}
